<template>
  <div>
    <Header />
    <TapMessage :titleNav="{ folMsg, navFolMsg1, navFolMsg2 }" />
    <Footer v-if="!$route.meta.isHideFooter" />
  </div>
</template>

<script>
import TapMessage from "@/components/TapMessage";
import { mapState } from "vuex";
export default {
  name: "Follow",
  data() {
    return {
      folMsg: "我的关注",
      navFolMsg1: "关注我的人",
      navFolMsg2: "我关注的人",
      userInfo: {},
      userId: null,
    };
  },
  components: {
    TapMessage,
  },
  computed: {
    ...mapState({
      conditionList: (state) => state.search.conditionList,
      userData: (state) => state.search.userData,
    }),

  },
  /* methods:{
    ...mapMutations(["GETUSERDATA"])
  }, */
  mounted() {
    const { userId } = this.$route.query;
    this.userId = userId * 1;
    //console.log(this.userId);
    // 获取总数据，选出对应下标的数据进行展示
    if (this.userId) {
      this.userInfo = this.conditionList.list.find((item) => {
        // 因为传过来的ID是变成了字符串，但是数据里是数字，所以要转数字
        return item.objectID == this.userId;
      });
      //把 this.userInfo 放入vuex
        this.$store.commit("GETUSERDATA", this.userInfo);
      //console.log(this.userInfo);
      //this.$bus.$emit("userInfo", this.userInfo);
    }
  },
};
</script>

<style lend="stylus" scoped>
</style>
